import {createRouter, createWebHistory} from 'vue-router'
import LoginView from "@/view/LoginView.vue";
import Index from "@/view/Index.vue";
import TextView from "@/view/TextView.vue";

const router = createRouter({
    history: createWebHistory(),
    routes: [
        {
            path: '/',
            component: LoginView
        },
        {
            path: '/index',
            component: Index,
            // 二级路由
            children: [
                /*----------------------------------用户列表-----------------------------------*/
                {
                    path: 'user',
                    component: () => import('@/view/user/UserView.vue')
                },
                {
                    path: 'user/detail/:userId',
                    component: () => import('@/view/user/UserDetailView.vue')
                },
                {
                    path: 'user/edit/:userId',
                    component: () => import('@/view/user/UserAddOrEditView.vue')
                },
                //添加用户
                {
                    path: 'user/add',
                    component: () => import('@/view/user/UserAddOrEditView.vue')
                },
                /*----------------------------------活动列表-----------------------------------*/
                {
                    path: 'activity',
                    component: () => import('@/view/activity/ActivityView.vue')
                },
                {
                    path: 'activity/detail/:id',
                    component: () => import('@/view/activity/ActivityDetailView.vue')
                },
                {
                    path: 'activity/addActivity',
                    component: () => import('@/view/activity/ActivityAddOrEditView.vue')
                },
                {
                    path: 'activity/editActivity/:id',
                    component: () => import('@/view/activity/ActivityAddOrEditView.vue')
                },
                /*----------------------------------线索列表-----------------------------------*/
                {
                    path: 'clue',
                    component: () => import('@/view/clue/ClueView.vue')
                },
                {
                    path: 'clue/detail/:id',
                    component: () => import('@/view/clue/ClueDetailView.vue')
                },
                {
                    path: 'clue/add',
                    component: () => import('@/view/clue/ClueAddOrEditView.vue')
                },
                {
                    path: 'clue/edit/:id',
                    component: () => import('@/view/clue/ClueAddOrEditView.vue')
                },
                /*----------------------------------客户列表-----------------------------------*/
                {
                    path: 'customer',
                    component: () => import('@/view/customer/CustomerView.vue')
                },
                {
                    path: 'customer/detail/:id',
                    component: () => import('@/view/customer/CustomerDetailView.vue')
                },
                /*----------------------------------交易列表-----------------------------------*/
                {
                    path: 'tran',
                    component: () => import('@/view/tran/TranView.vue')
                },
                {
                    path: 'tran/detail/:id',
                    component: () => import('@/view/tran/TranDetailView.vue')
                },
                {
                    path: 'tran/add',
                    component: () => import('@/view/tran/TranAddOrEditView.vue')
                },
                {
                    path: 'tran/edit/:id',
                    component: () => import('@/view/tran/TranAddOrEditView.vue')
                },
            ]
        },
        {
            path: '/text',
            component: TextView
        },
    ]
})
export default router;